/**
 * @description 全局自定义指令
 */

import type { App as AppType, Directive } from 'vue'

interface DirectiveListChildType {
    name: string
    directive: Directive
}

const directiveList: DirectiveListChildType[] = [
    {
        name: 'v-color',
        directive: {
            created(el: HTMLElement, binding: any, vnode: any, prevVnode: any) {
                el.style.color = 'red'
            }
        }
    }
]

export default {
    install(app: AppType) {
        directiveList.forEach(({ name, directive }) => {
            app.directive(name, directive)
        })
    }
}
